package com.bunhann.khmercurrencyexchangeinfo;

import android.app.Application;
import android.app.Instrumentation;
import android.content.Context;

import com.drivemode.android.typeface.TypefaceHelper;

/**
 * Created by bunhann on 5/3/16.
 */
public class KhmerCurrencyApp extends Application {

    private static KhmerCurrencyApp instance;


    /**
     * Create main application
     */
    public KhmerCurrencyApp() {
    }

    /**
     * Create main application
     *
     * @param context
     */
    public KhmerCurrencyApp(final Context context){
        this();
        attachBaseContext(context);
    }
    public KhmerCurrencyApp(final Instrumentation instrumentation) {
        this();
        attachBaseContext(instrumentation.getTargetContext());
    }

    @Override
    public void onCreate() {
        super.onCreate();
        TypefaceHelper.initialize(this);
        instance = this;
    }

    public static KhmerCurrencyApp getInstance() {
        return instance;
    }

    @Override
    public void onTerminate() {
        TypefaceHelper.destroy();
        super.onTerminate();
    }
}
